package o;

import android.content.Context;
import android.widget.Toast;
import com.huawei.appgallery.forum.option.api.IPublishPostActivityProtocol;
import com.huawei.appgallery.forum.option.api.IPublishPostActivityResult;
import com.huawei.hmf.annotation.ApiDefine;
import com.huawei.hmf.annotation.Singleton;
import java.util.concurrent.Callable;

@ApiDefine(uri = bya.class)
@Singleton
public class byn implements bya {

    static class c implements Callable<byj> {
        private c() {
        }

        public /* synthetic */ Object call() throws Exception {
            return ˏ();
        }

        public byj ˏ() {
            byj o_byj = new byj();
            o_byj.ॱ(2);
            return o_byj;
        }
    }

    static class e implements fjq<Boolean> {
        private final fjx<byj> ʽ;
        private final byd ˊ;
        private final Context ˋ;
        private final boolean ˎ;
        private final byj ˏ;
        private final String ॱ;

        e(String str, boolean z, byd o_byd, Context context, byj o_byj, fjx<byj> o_fjx_o_byj) {
            this.ˎ = z;
            this.ˊ = o_byd;
            this.ˋ = context;
            this.ˏ = o_byj;
            this.ʽ = o_fjx_o_byj;
            this.ॱ = str;
        }

        public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
            if (!o_fjo_java_lang_Boolean.ˊ()) {
                return;
            }
            if (((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                fjb ˎ = fho.ˏ().ˋ("Option").ˎ("option.publish");
                IPublishPostActivityProtocol iPublishPostActivityProtocol = (IPublishPostActivityProtocol) ˎ.ˊ();
                iPublishPostActivityProtocol.setIsUpdate(this.ˎ);
                iPublishPostActivityProtocol.setPublishData(this.ˊ);
                iPublishPostActivityProtocol.setDomainId(this.ॱ);
                fiu.ˊ().ॱ(this.ˋ, ˎ, new fjc<IPublishPostActivityResult>(this) {
                    final /* synthetic */ e ˋ;

                    {
                        this.ˋ = r1;
                    }

                    public /* synthetic */ void ˎ(int i, Object obj) {
                        ˊ(i, (IPublishPostActivityResult) obj);
                    }

                    public void ˊ(int i, IPublishPostActivityResult iPublishPostActivityResult) {
                        bqx.ˏ("OptionImpl", "modify post result:" + i);
                        if (i == -1 && iPublishPostActivityResult != null) {
                            this.ˋ.ˏ.ॱ(iPublishPostActivityResult.getPublishPostResult());
                        }
                        this.ˋ.ˏ.ॱ(i);
                        this.ˋ.ʽ.ॱ(this.ˋ.ˏ);
                    }
                });
                return;
            }
            this.ˏ.ॱ(2);
            this.ʽ.ॱ(this.ˏ);
        }
    }

    public fjo<byl> ˎ(String str, byl o_byl, long j) {
        return new bzb(str, o_byl, j).ˊ();
    }

    public fjo<byl> ॱ(String str, byl o_byl, int i) {
        return new bzb(str, o_byl, i).ˊ();
    }

    public fjo<bye> ॱ(String str, byg o_byg, Context context) {
        return new byi(str, o_byg, context).ॱ();
    }

    public fjo<byj> ˏ(String str, Context context, boolean z, byd o_byd) {
        fjx o_fjx = new fjx();
        Object o_byj = new byj();
        if (doo.ˊ(context)) {
            ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(context, 15).ˏ(new e(str, z, o_byd, context, o_byj, o_fjx));
        } else {
            Toast.makeText(context, context.getString(bse.ˏ.ˏ()), 0).show();
            o_byj.ॱ(4);
            o_fjx.ॱ(o_byj);
        }
        return o_fjx.ॱ();
    }

    public fjo<byj> ˏ(String str, Context context, boolean z, byd o_byd, int i) {
        if (i != 1) {
            return ˏ(str, context, z, o_byd);
        }
        Toast.makeText(context, bse.ˏ.ॱ(400009).ˏ(), 0).show();
        return fjw.ˏ(new c());
    }
}
